package com.cdc.selectionsort;

import java.util.Arrays;


public class SelectionSort {

	public static void main(String[] args) {
		int [] array=ArrayTool.initArray(5);
		System.out.println("排序前："+Arrays.toString(array));
		selectionSort(array);
		System.out.println("排序后："+Arrays.toString(array));
		

	}
	
	private static void selectionSort(int [] arr) {
		for (int i = 0; i < arr.length-1; i++) {
			for (int j = i+1; j < arr.length; j++) {
				if(arr[i]>arr[j]) {
					int temp=arr[i];
					arr[i]=arr[j];
					arr[j]=temp;
				}
			}
		}
	}

}
